# coding=utf-8
class Solution:
    def convert(self, s: str, numRows: int) -> str:
        if numRows < 2:
            return s
        result = ['' for i in range(numRows)]
        i = 0
        flag = -1
        for c in s:
            result[i] += c
            if i == 0 or i == numRows - 1:
                flag = -flag
            i += flag
        return ''.join(result)
